package com.neuedu.nevserver.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.neuedu.nevserver.mapper.SlauBatchMapper;
import com.neuedu.nevserver.pojo.WholBatch;
import com.neuedu.nevserver.mapper.WholBatchMapper;
import com.neuedu.nevserver.service.WholBatchService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.neuedu.nevserver.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author sjy
 * @since 2025-03-18
 */
@Service
public class WholBatchServiceImpl extends ServiceImpl<WholBatchMapper, WholBatch> implements WholBatchService {

    @Autowired
    private WholBatchMapper wholBatchMapper;

    @Override
    public ResultVO<List<WholBatch>> listWholBatch(WholBatch wholBatch) throws Exception{
        QueryWrapper qw = new QueryWrapper();
        if(wholBatch.getSbId()!=null){
            qw.eq("sb_id", wholBatch.getSbId());
        }
        if(wholBatch.getBatchId()!=null && !wholBatch.getBatchId().equals("")){
            qw.eq("batch_id", wholBatch.getBatchId());
        }
        if(wholBatch.getNodeId()!=null){
            qw.eq("node_id", wholBatch.getNodeId());
        }
        if(wholBatch.getType()!=null && !wholBatch.getType().equals("")){
            qw.eq("type", wholBatch.getType());
        }
        if(wholBatch.getState()!=null) {
            qw.eq("state", wholBatch.getState());
        }
        return ResultVO.success(null, wholBatchMapper.selectList(qw));
    }
}
